<?php

$url = explode("/", $_SERVER['HTTP_REFERER']);
if (strcmp($url[count($url) - 1], 'register.php') != 0) {
  header("Location: register.php");
}

session_start();

if ( isset($_SESSION['username']) ) { $username = $_SESSION['username']; }
if ( isset($_SESSION['affiliation']) ) { $affiliation = $_SESSION['affiliation']; }
if ( isset($_SESSION['title']) ) { $title = $_SESSION['title']; }
if ( isset($_SESSION['telephone']) ) { $telephone = $_SESSION['telephone']; }
if ( isset($_SESSION['email']) ) { $email = $_SESSION['email']; }
if ( isset($_SESSION['division']) ) { $division = $_SESSION['division']; }
if ( isset($_SESSION['other_division']) ) { $other_division = $_SESSION['other_division']; }
if ( isset($_SESSION['lunch_time']) ) { $lunch_time = $_SESSION['lunch_time']; }
if ( isset($_SESSION['is_vegetarian']) ) { $is_vegetarian = $_SESSION['is_vegetarian']; }
if ( isset($_SESSION['notes']) ) { $notes = $_SESSION['notes']; }
if ( isset($_SESSION['needDisabledAccess']) ) { $needDisabledAccess = $_SESSION['needDisabledAccess']; }
if ( isset($_SESSION['participateSubmission']) ) { $participateSubmission = $_SESSION['participateSubmission']; }

session_unset();
session_destroy();

$_SESSION = array();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="style.css" type="text/css" />
  <title>第四十八屆台灣心理學年會報名系統</title>
</head>

<body>
  <div id="container">
    <div id="header">
      <h1>報名<span class="h1_span">成功</span></h1>
    </div>

    <h2>報名成功！確認信將寄送到 <?php echo $email ?></h2>

    <h3>您填寫的報名資訊如下：</h3>

    <div>
      <fieldset>
      <legend>個人資訊</legend>
        <ul>
			  <li>姓名：<?php echo $username ?></li>
		  	<li>單位：<?php echo $affiliation ?></li>
			  <li>職稱：<?php echo $title ?></li>
			  <li>聯絡電話：<?php echo $telephone ?></li>
			  <li>電子郵件：<?php echo $email ?></li>
			  <li>參加組別：
        <?php
          if (strcmp($division, 'other') == 0) {
            echo "$other_division";
          }
          else {
            if (strcmp($division, 'cognitive') == 0) { echo '認知'; }
            if (strcmp($division, 'educational') == 0) { echo '教心'; }
            if (strcmp($division, 'io') == 0) { echo '工商'; }
            if (strcmp($division, 'social') == 0) { echo '社心人格'; }
            if (strcmp($division, 'clinical') == 0) { echo '臨床諮商'; }
            if (strcmp($division, 'psychometric') == 0) { echo '計量'; }
            if (strcmp($division, 'developmental') == 0) { echo '發展'; }
            if (strcmp($division, 'biological') == 0) { echo '生心'; }
          }
        ?>
        </li>
		    </ul>
      </fieldset>
      <fieldset>
      <legend>午餐資訊</legend>
        <ul>
			  <li>用餐時段：
        <?php
          if (strcmp($lunch_time, '') == 0) {
            echo '不用餐';
          }
          else {
            echo "9 月 $lunch_time 日";
          }
        ?>
        </li>
		  	<li>用餐習慣：
        <?php
          if (strcmp($lunch_time, '') == 0) {
            echo '不用餐';
          }
          else {
            if (strcmp($is_vegetarian, '0') == 0) {
              echo '葷素不拘';
            }
            if (strcmp($is_vegetarian, "1") == 0) {
              echo '素食';
            }
            if ((strcmp($is_vegetarian, "0") != 0) && (strcmp($is_vegetarian, "1") != 0)) {
              echo '葷素不拘';
            }
          }
        ?>
        </li>
			  <li>備註：
        <?php
          if (strcmp($lunch_time, '') == 0) {
            echo '不用餐';
          }
          else {
            echo $notes;
          }
        ?>
        </li>
		    </ul>
      </fieldset>
      <fieldset>
      <legend>其他資訊</legend>
        <ul>
			  <li>無障礙設施：
        <?php
          if (strcmp($needDisabledAccess, '0') == 0) {
            echo '不需要';
          }
          if (strcmp($needDisabledAccess, "1") == 0) {
            echo '需要';
          }
          if ((strcmp($needDisabledAccess, "0") != 0) && (strcmp($needDisabledAccess, "1") != 0)) {
            echo '不需要';
          }
        ?>
        </li>
		  	<li>是否參加投稿：
        <?php
          if (strcmp($participateSubmission, '0') == 0) {
            echo '否';
          }
          if (strcmp($participateSubmission, "1") == 0) {
            echo '是';
          }
          if ((strcmp($participateSubmission, "0") != 0) && (strcmp($participateSubmission, "1") != 0)) {
            echo '否';
          }
        ?>
        </li>
        </ul>
      </fieldset>
    </div>

    <div id="footer">
      <p>&copy; 2009 第四十八屆台灣心理學年會</p>
    </div>

  </div>
</body>
</html>